var web3 = require('./getWeb3');
var BigNumber = require('bignumber.js');

//获取版本
// var version = web3.version;
// console.log("web3的version:"+version); 

//创建新账户
 // var account = web3.eth.accounts.create();
 // var address = account.address;
 // console.log('address:',address);
 
 //获得账户余额
 web3.eth.getBalance('0x1CC5542937D9d6c398602ff454397fCa21204f23').then(function(balance){
      console.log('balance:',balance)
      var b1 = new BigNumber(balance)
      console.log('b1:',b1)
 
      var b2 = web3.utils.toBN(balance).toString();
      console.log('b2:',b2)
 
 })
 
//返回当前节点持有的帐户列表
// var accounts = web3.eth.accounts;
// console.log(accounts);

//获取链上指定合约地址的代码
web3.eth.getCode("0x7814C2793FB5257Ea30AD6AEE818dD57d4fbbc1b").then(console.log)

//返回指定编号或哈希的块.
web3.eth.getBlock(0).then(console.log)

//获取交易
//web3.eth.getTransaction('').then(console.log)